home *** CD-ROM | disk | FTP | other *** search
- Path: netnews.upenn.edu!dsinc!ub!newserve!rebecca!rpi!not-for-mail
- From: Tony Confrey <ac11@gte.com>
- Newsgroups: comp.lang.c++,comp.lang.c++.moderated,comp.object
- Subject: C++ objects in shared memory
- Date: 5 Apr 1996 00:16:10 -0000
- Organization: GTE Labs
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: herbs@connobj.com
- Message-ID: <4k1ooa$lru@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: Tue, 02 Apr 1996 15:54:08 -0500
-
- Apologies if you've already seen this, I'm unclear if my newsreader
- is set up correctly.
-
- I am trying to store instances of C++ objects in shared memory so
- that their function and data members can be accessed by multiple
- processes running on the same unix box.
-
- Storing the instance in shared memory is no problem - I've been using
- placement new with a previously allocated block of shared memory that
- all processes connect to. Calling member functions, in particular
- virtual member functions, is more difficult.
-
- I'm finding (actually more like deducing) the following: If process
- A creates an instance then the vtbl points to function addresses in
- process A's address space. Calling non virtual functions or
- accessing data members from another process, B, works fine.
- However calling virtual functions from B segv's because its
- trying to call outside its address space.
-
- For a while it looked like linking the class library as a shared library
- would work - in fact it does under aix - because the functions end up in
- the same place in memory. However under solaris the address spaces are
- mapped differently.
-
- Any suggestion would be appreciated. Can this be done? Is there some
- other approach I should take? I find it hard to believe that no
- one has ever tried such a thing.
-
- Thanks
-
- Tony
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-